# vim:ts=4:sw=4:noet:
""" Toolbar """

import wx
import c.ui.wxw.common as common
from c.ui.wxw.ids import ids, shortcuts

class MainToolBar(wx.ToolBar):

	def __init__(self, parent):
		if wx.Platform == '__WXMAC__':
			wx.ToolBar.__init__(self, parent, style=(
				wx.TB_HORIZONTAL|wx.NO_BORDER|wx.TB_FLAT|wx.TB_TEXT))
			self.SetMargins(wx.Size(5, 4))
		else:
			wx.ToolBar.__init__(self, parent, style=(
				wx.TB_HORIZONTAL|wx.NO_BORDER|wx.TB_FLAT))
		self.SetToolBitmapSize(wx.Size(32, 32))

		self.addButton(ids.PROJECT_RUN, 
				"Run", "IM_ToolRun.png", "Run Program")
		self.addButton(ids.PROJECT_STOP, 
				"Stop", "IM_ToolStop.png", "Stop Program")
		self.addButton(ids.PROJECT_COMPILE, 
				"Check", "IM_ToolCompile.png", "Check Code")
		self.addButton(ids.VIEW_DOCUMENTATION,
				"Docs", "IM_ToolDocs.png", "Show Documentation")

		self.Bind(wx.EVT_TOOL, parent.OnToolClick)

	def addButton(self, id, name, image, help):
		self.AddLabelTool(
				id, 
				name, 
				common.loadWxImage(image),
				shortHelp=help,
				longHelp=help)
